home *** CD-ROM | disk | FTP | other *** search
Oberon Text | 1994-07-11 | 3.0 KB | 57 lines | [.Ob./.Ob4] |
- Syntax10.Scn.Fnt
- MODULE Display1; (*mf 9.3.93*)
- IMPORT
- SYS := SYSTEM, Macintosh, Display;
- CONST
- white=0; grey1=1; grey2=2; grey3=3; grey4=4; black=5; texture0=6; texture1=7; texture2=8; texture3=9;
- scrPat: ARRAY 10 OF Display.Pattern;
- PROCEDURE Line*(F: Display.Frame; col, x0, y0, x1, y1, mode: INTEGER);
- BEGIN Macintosh.SetUserClip(F.X, Display.Height-F.Y, F.W, F.H);
- Macintosh.SetPenScreen(F.Y>=0, Macintosh.userClip, col, mode); Macintosh.Line(x0, Display.Height-1-y0, x1, Display.Height-1-y1)
- END Line;
- PROCEDURE Circle*(F: Display.Frame; col, x, y, r, mode: INTEGER);
- BEGIN Macintosh.SetUserClip(F.X, Display.Height-F.Y, F.W, F.H);
- Macintosh.SetPenScreen(F.Y>=0, Macintosh.userClip, col, mode); Macintosh.Circle(x, Display.Height-y, r)
- END Circle;
- PROCEDURE Ellipse*(F: Display.Frame; col, x, y, a, b, mode: INTEGER);
- BEGIN Macintosh.SetUserClip(F.X, Display.Height-F.Y, F.W, F.H);
- Macintosh.SetPenScreen(F.Y>=0, Macintosh.userClip, col, mode); Macintosh.Ellipse(x, Display.Height-y, a, b)
- END Ellipse;
- PROCEDURE NewPattern*(VAR image: ARRAY OF SET; w, h: INTEGER): Display.Pattern;
- BEGIN RETURN SYS.VAL(Display.Pattern, Macintosh.NewPatMap(image, w, h, 0))
- END NewPattern;
- PROCEDURE GetPatternSize*(pat: Display.Pattern; VAR w, h: INTEGER);
- BEGIN Macintosh.GetPatSize(pat, w, h)
- END GetPatternSize;
- PROCEDURE ThisPattern*(n: INTEGER): Display.Pattern;
- BEGIN RETURN scrPat[n]
- END ThisPattern;
- PROCEDURE InitPat;
- VAR img: ARRAY 10 OF SET;
- BEGIN
- img[1] := {};
- scrPat[white] := Display.NewPattern(img, 32, 1);
- img[4] := {0, 8, 16, 24}; img[3] := {}; img[2] := {4, 12, 20, 28}; img[1] := {};
- scrPat[grey1] := Display.NewPattern(img, 32, 4);
- img[2] := {0, 4, 8, 12, 16, 20, 24, 28}; img[1] := {2, 6, 10, 14, 18, 22, 26, 30};
- scrPat[grey2] := Display.NewPattern(img, 32, 2);
- img[2] := {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30}; img[1] := {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31};
- scrPat[grey3] := Display.NewPattern(img, 32, 2);
- img[2] := {1..3, 5..7, 9..11, 13..15, 17..19, 21..23, 25..27, 29..31}; img[1] := {0, 1, 3..5, 7..9, 11..13, 15..17, 19..21, 23..25, 27..29, 31};
- scrPat[grey4] := Display.NewPattern(img, 32, 2);
- img[1] := {0..31};
- scrPat[black] := Display.NewPattern(img, 32, 1);
- img[4] := {3, 7, 11, 15, 19, 23, 27, 31}; img[3] := {2, 6, 10, 14, 18, 22, 26, 30};
- img[2] := {1, 5, 9, 13, 17, 21, 25, 29}; img[1] := {0, 4, 8, 12, 16, 20, 24, 28};
- scrPat[texture0] := Display.NewPattern(img, 32, 4);
- img[4] := {0, 4, 8, 12, 16, 20, 24, 28}; img[3] := {1, 5, 9, 13, 17, 21, 25, 29};
- img[2] := {2, 6, 10, 14, 18, 22, 26, 30}; img[1] := {3, 7, 11, 15, 19, 23, 27, 31};
- scrPat[texture1] := Display.NewPattern(img, 32, 4);
- img[1] := {2, 6, 10, 14, 18, 22, 26, 30};
- scrPat[texture2] := Display.NewPattern(img, 32, 1);
- img[4] := {}; img[3] := {}; img[2] := {}; img[1] := {0..31};
- scrPat[texture3] := Display.NewPattern(img, 32, 4)
- END InitPat;
- BEGIN InitPat
- END Display1.
-